<!DOCTYPE html>
<html >
<head>

	<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/claro/claro.css" media="screen">
	
<script>dojoConfig = {async: true}</script>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js" data-dojo-config="isDebug: true, async: true"></script><script>require([
    "dojo/ready", "dojo/json", "dojo/request", "dojo/_base/window", "dojo/store/Memory",
    "dijit/tree/ObjectStoreModel", "dijit/Tree, dijit/layout/BorderContainer"
], function(ready, json, request, win, Memory, ObjectStoreModel, Tree, BorderContainer){

    // Create the Tree.   Note that all widget creation should be inside a dojo.ready().
    ready(function(){
	    // Create test store, adding the getChildren() method required by ObjectStoreModel
		bc = new BorderContainer({style: "width: 100%; height: 100%;"});
		center = new ContentPane({
			region: "center",
			style: "width: 500px; height: 500px;",
			content: ""});
		bc.addChild(center);
		request.get("getJson",{
			handleAs: "json"}).then(function(text){
				console.log(json.parse(text));
				var myStore = new Memory({
					data: [
						json.parse(text)
					],
					getChildren: function(object){
						return this.query({parent: object.id});
					}
				});
				console.log(myStore);

				// Create the model
				var myModel = new ObjectStoreModel({
					store: myStore,
					query: {id: "JSON"}
				});
				
				var tree = new Tree({
					model: myModel
				});
				tree.placeAt(win.body());
				tree.startup();
				center.set("content", [tree.domNode]);
				
				});
			docuement.body.appendChild(bc.domNode);
			bc.startup();
		});
	});
</script>
</head>
<body class="claro">
    
</body>
</html>